﻿/*
 * ============ [ 废土 ] ============
 *
 * [ 维护者 ]  argoran@gmail.com
 * [  状态  ]  原型
 *
 * ============ [ 注释 ] ============
 *
 * 服务器端程序指令处理代码
 *
 * ==================================
 */

using System;

using LastLand.Core.CmdInterpreter;
using LastLand.Data.Global;

namespace LastLand.Core
{
    public class CCommand
    {
        private ICommandInterpreter cmdInterp_;

        public void ExecuteCommand(String _cmd, String _args)
        {
            switch (_cmd)
            {
                case CConst.COMMAND_EXIT:
                    cmdInterp_ = new CCmdExit();
                    break;
                case CConst.COMMAND_IP_LIST:
                    cmdInterp_ = new CCmdIpList();
                    break;
                case CConst.COMMAND_START_SERVER:
                    cmdInterp_ = new CCmdStartServer();
                    break;
                case CConst.COMMAND_CLOSE_SERVER:
                    cmdInterp_ = new CCmdCloseServer();
                    break;
                default:
                    cmdInterp_ = new CCmdDefault();
                    break;
            }
            cmdInterp_.ExecuteCommand(_cmd, _args);
        }
    }
}
